{% load engine_tags %}
{% load humanize %}


{% if paths %}
    {% if not show_all %}

        <a class="ui label" onclick="window.history.back()"> <i class="left chevron icon"></i>Back</a>

    {% endif %}

    <div class="ui relaxed divided large list">


        {% for  real_path, rel_path, dir_names, last_name, tstamp, size, is_image, dir_name, is_dir in paths %}

            <div class="emphasize file {% if plugin and real_path|endswith:'.html' %}plugin{% endif %} item"
                 data-value="{{ dir_name }}/{{ last_name }}" data-plugin="{{ plugin }}">
                <span>

                    {% if uid %}

                        <a href="{% url serve_view uid=uid path=rel_path %}">
                            {% if is_image %}
                                <img class="ui small middle aligned image"
                                     src="{% url serve_view uid=uid path=rel_path %}">
                            {% endif %}
                            {{ rel_path }}
                        </a>
                    {% else %}

                        {% if is_dir %}
                            <a href="{% url 'file_list' rel_path %}"> {{ real_path }}/</a>
                        {% else %}
                            {{ real_path }}
                        {% endif %}

                    {% endif %}

                </span>
                {% if user.is_authenticated %}
                    <a class="ui small right floated label copy"> COPY</a>
                {% endif %}

                <span class="ui right floated small label">{{ size|filesizeformat }}</span>

                {% if plugin and real_path|endswith:'.html' %}
                    <div class="ui right floated small blue label">
                        <i class="expand icon"></i>{{ plugin|upper }}
                    </div>
                {% endif %}

            </div>
        {% endfor %}
    </div>

{% else %}

    <div class="ui icon info message">
        <i class="exclamation triangle icon"></i>
        <div class="content">
            <div class="header">
                No files were found
            </div>
        </div>
    </div>
{% endif %}